Request cannot be fulfilled due to bad sysntax 400

您所在的位置:网站首页 postman cannot post Request cannot be fulfilled due to bad sysntax 400

Request cannot be fulfilled due to bad sysntax 400

2024-07-13 05:32| 来源: 网络整理| 查看: 265

I have attached my postman error message.

PostmanEmessagePostmanEmessage1540脳1030 121 KB

My server.js

var sql = 'INSERT INTO products (productName, description, category,brand, expiredDate, manufacturedDate, batchNumber, unitPrice,quantity, createdDate) VALUES (?,?,?,?,?,?,?,?,?,?)' var parms = [productName, description, category,brand, expiredDate, manufacturedDate, batchNumber, unitPrice,quantity, createdDate] db.run(sql,parms,function(err, result){ if (err){ res.status(400).jason({"error":err.message}) return; }else{ res.json({ "message":"success", 'data':res.body, "id":this.lastID }) }

My database.js

let db = new sqlite3.Database(DBSOURCE,(err) => { if(err){ console.error(err.message) throw err }else{ console.log(`Connected to the SQlite Data base') db.run( 'CREATE TABLE products ( id INTEGER PRIMARY KEY AUTOINCREMENT, productName text, description text, category text, brand text, expiredDate text, manufacturedDate text, batchNumber INTEGER, unitPrice INTEGER, quantity INTEGER, createdDate text )`, (err) => { if (err){ // table already created } else { var insert = 'INSERT INTO products' (productName, description, category,brand, expiredDate, manufacturedDate, batchNumber, unitPrice,quantity, createdDate) db.run(insert,["white basmathi rice", "whitebasmathiaaaa", "Rice", "CIC", "2033.10.3", "2021.05.15", 515, 333, 2500, "2021.09.10"]) } } ) } });

Thanks for helps.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3